Indoor Positioning Method and Device

ABSTRACT

An indoor positioning method includes: obtaining, by a terminal, all predicted locations of a current location, predicting, according to historical movement information of the terminal, a first probability that the terminal passes through each predicted location at a next moment, and obtaining, based on strength of a received signal, a second probability that the terminal passes through each predicted location at the next moment; and generating a corresponding third probability according to the first probability and the second probability that are corresponding to each predicted location, and determining a predicted location point with a highest third probability as a location of the terminal at a second moment.

TECHNICAL FIELD

Embodiments of the present invention relate to positioning technologies,and in particular, to an indoor positioning method and device.

BACKGROUND

In a modern city, residents spend an average of 70% of time indoorsevery day. Therefore, there is a great demand for functions such aspositioning in an indoor environment and navigation, people search, andobject search that are derived from the positioning. When arriving atthe ground, a satellite signal is relatively weak and cannot penetrate abuilding. Consequently, the existing GPS (Global Positioning System,Global Positioning System) cannot be directly used for positioning in anindoor environment. Basically, a wireless communication manner such as aBluetooth beacon based, a Wi-Fi (Wireless Fidelity, Wireless Fidelity)AP (Access Point, access point) based, or a macro base station basedpositioning technology is used for current indoor positioning. For theBluetooth beacon based and Wi-Fi AP based positioning technologies, aterminal side implements positioning on the terminal. For the macro basestation based positioning technology, a network side server performspositioning on a terminal connected to a network.

From a perspective of an implementation means, an RSSI (Received SignalStrength Indicator, received signal strength indicator) basedpositioning technology is mostly used in the existing Bluetooth beaconbased and Wi-Fi AP based indoor positioning technologies.

The RSSI based positioning technology is implemented according to anenergy attenuation model of an electromagnetic wave that is beingpropagated in free space. A negative correlation relationship existsbetween receive strength of a signal and a propagation distance of thesignal. That is, the receive strength of the signal attenuates with anincrease in the propagation distance. A shorter distance between areceiver and a sender leads to higher strength of a signal received bythe receiver; and a longer distance between the receiver and the senderleads to lower strength of a signal received by the receiver. Thedistance between the receiver and the sender may be estimated accordingto the receive strength of the signal received by the receiver and aknown wireless signal attenuation model; and a location of the sender orthe receiver may be calculated according to multiple estimated distancevalues.

The RSSI based positioning technology has low positioning accuracybecause of two main aspects: On the one hand, the receive strength ofthe signal is a time-based variable. That is, when the distance betweenthe receiver and the sender remains unchanged, the receive strength ofthe signal obtained by the receiver varies with time. Furthermore, largequantities of interference factors exist in an actual environment.Consequently, the simple negative correlation relationship between thereceive strength of the signal and the propagation distance of thesignal becomes more unreliable, and a unique location of the terminalcannot be accurately determined according to the strength of thereceived signal. On the other hand, large quantities of interferencefactors, such as a body block, traffic, and movement of a mobile object,affect the receive strength of the signal. Because of impact of theseunstable interference factors, even though a user stands at a samelocation, the receive strength of the signal obtained by the terminal isgreatly different due to factors such as a different body direction andpopulation density. Consequently, the unique location of the terminalcannot be determined according to the strength of the received signal.

In conclusion, the RSSI based positioning technology in the prior arthas relatively low positioning accuracy because of an uncertainpositioning result caused by ranging and positioning based only on thestrength of the received signal.

SUMMARY

Embodiments of the present invention provide an indoor positioningmethod and device, to resolve a problem of relatively low positioningaccuracy in an RSSI based positioning technology.

Specific technical solutions provided in the embodiments of the presentinvention are as follows:

According to a first aspect, an indoor positioning method is provided,including:

obtaining, by a terminal, a first location of the terminal at a firstmoment;

obtaining, by the terminal, all predicted locations corresponding to thefirst location, where all the predicted locations include at least twopredicted locations;

obtaining, by the terminal according to historical movement informationof the terminal, a first probability corresponding to each predictedlocation, where a first probability corresponding to a first predictedlocation is a probability obtained according to the historical movementinformation of the terminal by predicting that the terminal is locatedat the first predicted location at a second moment, the first predictedlocation is any one of all the predicted locations, and the secondmoment is later than the first moment;

obtaining, by the terminal, signal strength of at least one wirelesssignal received by the terminal at the second moment;

obtaining, by the terminal according to the signal strength of the atleast one wireless signal, a second probability corresponding to eachpredicted location; where a second probability corresponding to thefirst predicted location is a probability that is obtained according tothe signal strength of the at least one wireless signal and thatindicates that the terminal is located at the first predicted locationat the second moment;

obtaining, by the terminal according to the first probability and thesecond probability that are corresponding to each predicted location, athird probability corresponding to each predicted location; and

determining, by the terminal, a predicted location with a highest thirdprobability in all the predicted locations as a second location of theterminal at the second moment.

With reference to the first aspect, in a first possible implementationof the first aspect, the obtaining, by the terminal, all predictedlocations corresponding to the first location includes:

obtaining, by the terminal, a type of a geographical region in which thefirst location is located; and

obtaining, by the terminal according to the type of the geographicalregion in which the first location is located, all the predictedlocations corresponding to the first location; or

obtaining, by the terminal, a type of a geographical region in which thefirst location is located and a historical movement speed of theterminal; and obtaining, by the terminal according to the type of thegeographical region in which the first location is located and thehistorical movement speed of the terminal, all the predicted locationscorresponding to the first location.

Herein, all the predicted locations corresponding to the first locationare obtained according to the type of the geographical region in whichthe first location is located. In a geographical region of a particulartype, a movement direction of the terminal is predictable. Therefore, apredicted location of the terminal can be more accurate and realistic.

With reference to the first possible implementation of the first aspect,in a second possible implementation of the first aspect, thegeographical region type includes a unidirectional corridor, abidirectional corridor, a unidirectional arc-shaped corridor, abidirectional arc-shaped corridor, a plaza, and a connection region;where the unidirectional corridor is a rectilinear corridor allowing apedestrian to walk in one direction;

the bidirectional corridor is a rectilinear corridor allowing apedestrian to walk in both directions;

the unidirectional arc-shaped corridor is an arc-shaped corridorallowing a pedestrian to walk in one direction;

the bidirectional arc-shaped corridor is an arc-shaped corridor allowinga pedestrian to walk in both directions;

the plaza is a region in which a walking direction of a pedestrian isnot restricted; and

the connection region is a region connecting at least two geographicalregions.

Herein, the geographical region in which the positioning terminal may belocated is divided according to the geographical region type. Whenpositioning and location prediction are performed on the terminal, allthe predicted locations corresponding to the first location of theterminal can be rapidly determined. Therefore, positioning accuracy ofthe terminal is further improved, and a positioning speed of theterminal is increased.

With reference to the first aspect, the first possible implementation ofthe first aspect, or the second possible implementation of the firstaspect, in a third possible implementation of the first aspect, thehistorical movement information of the terminal includes at least one ormore of the following: a movement location of the terminal in a presetperiod previous to the first moment, a movement speed of the terminal inthe preset period previous to the first moment, or a movement directionof the terminal in the preset period previous to the first moment.

With reference to any one of the first aspect or the foregoing possibleimplementations, in a fourth possible implementation of the firstaspect, the obtaining, by the terminal according to the firstprobability and the second probability that are corresponding to eachpredicted location, a third probability corresponding to each predictedlocation includes:

performing, by the terminal, weighted summation on the first probabilityand the second probability that are corresponding to each predictedlocation, to obtain the third probability corresponding to eachpredicted location; or multiplying, by the terminal, the firstprobability and the second probability that are corresponding to eachpredicted location, to obtain the third probability corresponding toeach predicted location.

According to a second aspect, a terminal is provided, including:

a communications device, configured to send and receive a wirelesssignal;

a sensor, configured to obtain movement information of the terminal; and

a processor, configured to:

obtain a first location of the terminal at a first moment;

obtain all predicted locations corresponding to the first location;

obtain, according to historical movement information of the terminal, afirst probability corresponding to each predicted location;

obtain signal strength of at least one wireless signal received by thecommunications device at the second moment;

obtain, according to the signal strength of the at least one wirelesssignal, a second probability corresponding to each predicted location;

obtain, according to the first probability and the second probabilitythat are corresponding to each predicted location, a third probabilitycorresponding to each predicted location; and

determine a predicted location with a highest third probability in allthe predicted locations as a second location of the terminal at thesecond moment; where

all the predicted locations include at least two predicted locations, afirst probability corresponding to a first predicted location is aprobability obtained according to the historical movement information ofthe terminal by predicting that the terminal is located at the firstpredicted location at the second moment, the first predicted location isany one of all the predicted locations, the second moment is later thanthe first moment, and a second probability corresponding to the firstpredicted location is a probability that is obtained according to thesignal strength of the at least one wireless signal and that indicatesthat the terminal is located at the first predicted location at thesecond moment.

With reference to the second aspect, in a first possible implementationof the second aspect, when obtaining all the predicted locationscorresponding to the first location, the processor is specificallyconfigured to:

obtain a type of a geographical region in which the first location islocated; and

obtain, according to the type of the geographical region in which thefirst location is located, all the predicted locations corresponding tothe first location; or obtain a type of a geographical region in whichthe first location is located and a historical movement speed of theterminal;

obtain, according to the type of the geographical region in which thefirst location is located and the historical movement speed of theterminal, all the predicted locations corresponding to the firstlocation.

Herein, all the predicted locations corresponding to the first locationare obtained according to the type of the geographical region in whichthe first location is located. In a geographical region of a particulartype, a movement direction of the terminal is predictable. Therefore, apredicted location of the terminal can be more accurate and realistic.

With reference to the first possible implementation of the secondaspect, in a second possible implementation of the second aspect, thegeographical region type includes a unidirectional corridor, abidirectional corridor, a unidirectional arc-shaped corridor, abidirectional arc-shaped corridor, a plaza, and a connection region;where the unidirectional corridor is a rectilinear corridor allowing apedestrian to walk in one direction;

the bidirectional corridor is a rectilinear corridor allowing apedestrian to walk in both directions;

the unidirectional arc-shaped corridor is an arc-shaped corridorallowing a pedestrian to walk in one direction;

the bidirectional arc-shaped corridor is an arc-shaped corridor allowinga pedestrian to walk in both directions;

the plaza is a region in which a walking direction of a pedestrian isnot restricted; and

the connection region is a region connecting at least two geographicalregions.

Herein, the geographical region in which the positioning terminal may belocated is divided according to the geographical region type. Whenpositioning and location prediction are performed on the terminal, allthe predicted locations corresponding to the first location of theterminal can be rapidly determined. Therefore, positioning accuracy ofthe terminal is further improved, and a positioning speed of theterminal is increased.

With reference to the second aspect, the first possible implementationof the second aspect, or the second possible implementation of thesecond aspect, in a third possible implementation of the second aspect,the historical movement information of the terminal includes at leastone or more of the following: a movement location of the terminal in apreset period previous to the first moment, a movement speed of theterminal in the preset period previous to the first moment, or amovement direction of the terminal in the preset period previous to thefirst moment.

With reference to any one of the second aspect or the foregoing possibleimplementations, in a fourth possible implementation of the secondaspect, when obtaining, according to the first probability and thesecond probability that are corresponding to each predicted location,the third probability corresponding to each predicted location, theprocessor is specifically configured to:

perform weighted summation on the first probability and the secondprobability that are corresponding to each predicted location, to obtainthe third probability corresponding to each predicted location; or

multiply the first probability and the second probability that arecorresponding to each predicted location, to obtain the thirdprobability corresponding to each predicted location.

According to a third aspect, an indoor positioning apparatus isprovided, including:

a first obtaining unit, configured to:

obtain a first location of the apparatus at a first moment;

obtain all predicted locations corresponding to the first location; and

obtain, according to historical movement information of the apparatus, afirst probability corresponding to each predicted location;

a second obtaining unit, configured to:

obtain signal strength of at least one wireless signal received by thecommunications device at the second moment; and

obtain, according to the signal strength of the at least one wirelesssignal, a second probability corresponding to each predicted location;

a third obtaining unit, configured to obtain, according to the firstprobability and the second probability that are corresponding to eachpredicted location, a third probability corresponding to each predictedlocation; and

a determining unit, configured to determine a predicted location with ahighest third probability in all the predicted locations as a secondlocation of the apparatus at the second moment; where

all the predicted locations include at least two predicted locations, afirst probability corresponding to a first predicted location is aprobability obtained according to the historical movement information ofthe apparatus by predicting that the apparatus is located at the firstpredicted location at the second moment, the first predicted location isany one of all the predicted locations, the second moment is later thanthe first moment, and a second probability corresponding to the firstpredicted location is a probability that is obtained according to thesignal strength of the at least one wireless signal and that indicatesthat the apparatus is located at the first predicted location at thesecond moment.

With reference to the third aspect, in a first possible implementationof the third aspect, when obtaining all the predicted locationscorresponding to the first location, the first obtaining unit isspecifically configured to:

obtain a type of a geographical region in which the first location islocated; and

obtain, according to the type of the geographical region in which thefirst location is located, all the predicted locations corresponding tothe first location; or

obtain a type of a geographical region in which the first location islocated and a historical movement speed of the apparatus; and

obtain, according to the type of the geographical region in which thefirst location is located and the historical movement speed of theapparatus, all the predicted locations corresponding to the firstlocation.

Herein, all the predicted locations corresponding to the first locationare obtained according to the type of the geographical region in whichthe first location is located. In a geographical region of a particulartype, a movement direction of the apparatus is predictable. Therefore,an obtained predicted location corresponding to the first location ofthe apparatus is more accurate and realistic.

With reference to the first possible implementation of the third aspect,in a second possible implementation of the third aspect, thegeographical region type includes a unidirectional corridor, abidirectional corridor, a unidirectional arc-shaped corridor, abidirectional arc-shaped corridor, a plaza, and a connection region;where

the unidirectional corridor is a rectilinear corridor allowing apedestrian to walk in one direction;

the bidirectional corridor is a rectilinear corridor allowing apedestrian to walk in both directions;

the unidirectional arc-shaped corridor is an arc-shaped corridorallowing a pedestrian to walk in one direction;

the bidirectional arc-shaped corridor is an arc-shaped corridor allowinga pedestrian to walk in both directions;

the plaza is a region in which a walking direction of a pedestrian isnot restricted; and

the connection region is a region connecting at least two geographicalregions.

Herein, the geographical region in which the apparatus may be located isdivided according to the geographical region type. When positioning andlocation prediction are performed on a terminal using the apparatus, allpredicted locations corresponding to a first location of the terminalcan be rapidly determined. Therefore, positioning accuracy and apositioning speed are further improved.

With reference to the third aspect, the first possible implementation ofthe third aspect, or the second possible implementation of the thirdaspect, in a third possible implementation of the third aspect, thehistorical movement information of the apparatus includes at least oneor more of the following: a movement location of the apparatus in apreset period previous to the first moment, a movement speed of theapparatus in the preset period previous to the first moment, and amovement direction of the apparatus in the preset period previous to thefirst moment.

With reference to any one of the third aspect or the foregoing possibleimplementations, in a fourth possible implementation of the thirdaspect, when obtaining, according to the first probability and thesecond probability that are corresponding to each predicted location,the third probability corresponding to each predicted location, thethird obtaining unit is specifically configured to:

perform weighted summation on the first probability and the secondprobability that are corresponding to each predicted location, to obtainthe third probability corresponding to each predicted location; or

multiply the first probability and the second probability that arecorresponding to each predicted location, to obtain the thirdprobability corresponding to each predicted location.

The embodiments of the present invention provide an indoor positioningsolution. The terminal obtains all predicted locations of a currentlocation, predicts, according to the historical movement information ofthe terminal, a first probability that the terminal passes through eachpredicted location at a next moment, receives a wireless signal sent bya positioning transmitter, obtains, based on strength of the receivedsignal, a second probability that the terminal passes through eachpredicted location at the next moment, generates, according to the firstprobability and the second probability that are corresponding to eachpredicted location, a third probability corresponding to each predictedlocation, and determines a predicted location point with a highest thirdprobability as a location of the terminal at the second moment. In thisway, in a terminal positioning process, a positioning location of theterminal is predicted by comprehensively analyzing the historicalmovement information of the terminal and the strength of the wirelesssignal received by the terminal, instead of simply depending on thestrength of the wireless signal received by the terminal. In theterminal positioning process, the historical movement information of theterminal is used to calculate an occurrence probability corresponding toa predicted location. Therefore, jump of the positioning location can beavoided, continuity of the positioning location of the terminal isensured, user experience is improved, and positioning accuracy can beimproved.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic flowchart of an indoor positioning methodaccording to an embodiment of the present invention;

FIG. 2 is a schematic diagram of different geographical regions obtainedby means of division in an indoor positioning environment according toan embodiment of the present invention;

FIG. 3 is a schematic diagram of a predicted location corresponding to ageographical region of a bidirectional corridor type according to anembodiment of the present invention;

FIG. 4 is a schematic diagram of a predicted location corresponding to ageographical region of a connection region type according to anembodiment of the present invention;

FIG. 5 is a schematic diagram of a predicted location corresponding to ageographical region of a plaza type according to an embodiment of thepresent invention;

FIG. 6 is a schematic diagram of a predicted location corresponding toanother connection region according to an embodiment of the presentinvention;

FIG. 7 is a diagram of a specific instance of a first probabilitycalculated for each predicted location in a bidirectional corridoraccording to an embodiment of the present invention;

FIG. 8 is a schematic diagram of RSSI feature space probabilitydistribution according to an embodiment of the present invention; and

FIG. 9 is a schematic structural diagram of an indoor positioningterminal according to an embodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

To make the objectives, technical solutions, and advantages of theembodiments of the present invention clearer, the following clearly andcompletely describes the technical solutions in the embodiments of thepresent invention with reference to the accompanying drawings in theembodiments of the present invention. Apparently, the describedembodiments are some but not all of the embodiments of the presentinvention. All other embodiments obtained by persons of ordinary skillin the art based on the embodiments of the present invention withoutcreative efforts shall fall within the protection scope of the presentinvention.

The embodiments of the present invention provide an indoor positioningmethod and apparatus, to resolve a problem of relatively low positioningaccuracy in an RSSI based positioning technology. The method and theapparatus are based on a same inventive concept. Because the method andthe apparatus have similar principles to resolve a problem,implementation of the apparatus and implementation of the method mayreference each other, and details are not repeated.

The following describes implementations of the present invention indetail with reference to the accompanying drawings.

As shown in FIG. 1, FIG. 1 is a flowchart of an indoor positioningmethod according to an embodiment of the present invention. Accuratepositioning can be implemented on a terminal in an indoor region byusing the method. A specific process is as follows:

Step 100: The terminal obtains a first location of the terminal at afirst moment.

Specifically, in step 100, this embodiment imposes no limitation on amethod for the terminal to obtain the first location of the terminal atthe first moment. The terminal may obtain the location of the terminalaccording to an existing indoor positioning technology. During specificimplementation, the terminal may obtain the location of the terminalaccording to the following specific cases:

A first case is as follows: The terminal has already used, before thefirst moment, the solution in this embodiment for positioning. That is,it is not the first time for the terminal to use the positioning methodin this embodiment for positioning. In this case, the first location ofthe terminal at the first moment is obtained by using the solution ofstep 100 to step 106 in this embodiment. That is, the location at thefirst moment, that is, the first location, may be obtained by using thesolution in this embodiment according to a location at a moment previousto the first moment and signal strength of a wireless signal received atthe first moment.

A second case is as follows: The terminal has not used a positioningfunction in this embodiment before the first moment. That is, it is thefirst time for the terminal to use the positioning method in thisembodiment at the first moment for positioning. In this case, theterminal may use the following manners to obtain the first location ofthe terminal at the first moment. A manner is as follows: If theterminal has enabled the positioning function before entering apositioning region, but positioning cannot be performed because theterminal is outside the positioning region and cannot receive a signalfrom a wireless signal transmitter deployed in the positioning region,usually, when a user is located on a border of the positioning region,for example, at a door, the terminal receives, for the first time, awireless signal sent by the wireless signal transmitter. Positioning isusually easily determined in such a border region. Therefore, theterminal determines a corresponding border location according to thewireless signal received for the first time, and uses the determinedborder location as the first location of the terminal at the firstmoment. Another case is as follows: If the terminal enables thepositioning function after entering a positioning region, when theterminal receives a signal from a wireless signal transmitter, theterminal may be located at any location in the positioning region, andhas no historical positioning information. In this case, according tothe prior art, a location of a positioning transmitter corresponding toa maximum RSSI value received by the terminal may be used as the firstlocation of the terminal at the first moment. Alternatively, anotherexisting positioning manner may be used.

Step 101: The terminal obtains all predicted locations corresponding tothe first location, where all the predicted locations include at leasttwo predicted locations.

Specifically, before step 101 is performed, to ensure that the terminalcan obtain all the predicted locations corresponding to the firstlocation, geographical region division may be performed, according to ageographical region type, on an indoor positioning region in which theterminal is located, and a geographical region type to which eachdivided geographical region belongs is notified to the terminal.Optionally, all predicted locations corresponding to each location arepredicted according to various types of geographical regions, and thenall the predicted locations corresponding to each location are sent tothe terminal. Optionally, the terminal externally obtains all thepredicted locations corresponding to the first location.

A movement trend of a user in a geographical region of a type ispredictable. Therefore, for ease of prediction of the movement trend ofthe terminal, an indoor region in which the terminal is located isdivided according to the geographical region type. For example, aunidirectional corridor is a rectilinear corridor allowing a pedestrianto walk in one direction. When a geographical region type of ageographical region in which the first location of the terminal islocated is the unidirectional corridor, the movement trend of theterminal is only to keep on moving along the unidirectional corridor.The geographical region type includes a unidirectional corridor, abidirectional corridor, a unidirectional arc-shaped corridor, abidirectional arc-shaped corridor, a plaza, and a connection region. Theunidirectional corridor is a rectilinear corridor allowing a pedestrianto walk in one direction, and the unidirectional corridor usuallyappears in an indoor environment such as an airport, a station, or aport of entry that requires traffic control. The bidirectional corridoris a rectilinear corridor allowing a pedestrian to walk in bothdirections, and the bidirectional corridor is a relatively commongeographical region type and usually appears in an indoor environmentsuch as a shopping mall, a supermarket, a garage, or a theater. Theunidirectional arc-shaped corridor is an arc-shaped corridor allowing apedestrian to walk in one direction. The bidirectional arc-shapedcorridor is an arc-shaped corridor allowing a pedestrian to walk in bothdirections. The plaza is a region in which a walking direction of apedestrian is not restricted, and the user may walk in any direction inthe plaza. The connection region is a region connecting at least twogeographical regions and includes an entrance, an exit, a branch point,or the like. When the user is located in the connection region, the usermay have multiple optional paths. Therefore, the connection region has arelatively high requirement for positioning accuracy. FIG. 2 shows aspecific instance of an indoor positioning environment on whichgeographical region division is performed. FIG. 2 may be an indoorenvironment of a shopping mall. The shopping mall includes multiplestores (stores A to K) and multiple paths for pedestrians to walk. Allpaths for walking may be equivalent to the indoor positioningenvironment in this embodiment. The indoor positioning environment isdivided into seven different geographical regions, and geographicalregion numbers and types are shown in Table 1.

TABLE 1 Region number Type 1 Bidirectional arc-shaped corridor 2Bidirectional corridor 3 Bidirectional corridor 4 Connection region 5Connection region 6 Plaza 7 Bidirectional corridor

An entire indoor positioning coverage area is divided into severalgeographical regions, to help predict a location at which the terminalmay be located at a next moment, and improve positioning accuracy of theterminal.

A predicted location of the terminal is a location point at which theterminal may be located at a next positioning moment (that is, a secondmoment). The predicted location depends on the type of the geographicalregion in which the first location is located. Different geographicalregion types are corresponding to different predicted locations.

Specifically, when obtaining all the predicted locations correspondingto the first location, the terminal may directly obtain, from a serverside based on the first location, all the predicted locationscorresponding to the first location, where all the predicted locationscorresponding to the first location are preset based on the type of thegeographical region in which the first location is located.Alternatively, the terminal may further use either of the following twomanners to obtain all the predicted locations corresponding to the firstlocation.

A first manner is as follows: The terminal obtains the type of thegeographical region in which the first location is located, and obtains,according to the type of the geographical region in which the firstlocation is located, all the predicted locations corresponding to thefirst location.

For example, the terminal determines that the geographical region typeof the geographical region in which the first location is located is acorridor. For the corridor, there is only a one-dimensional component.Therefore, the predicted location of the first location is a proximitylocation of the first location in a corridor direction. For aunidirectional corridor, a predicted location of the first location is aproximity location in a direction ahead of a specified walkingdirection. In a bidirectional corridor in an instance shown in FIG. 3,it is assumed that a current location point, that is, a first locationpoint, of the terminal is a point 0. In the bidirectional corridor, theuser may perform bidirectional movement in a corridor direction, or maykeep still. Therefore, the terminal may be located at a point 1 or apoint 2, or may be still located at the point 0 at the next moment. Thatis, predicted location points of the first location are the points 0, 1,and 2.

For another example, the terminal determines that the geographicalregion type of the geographical region in which the first location islocated is a connection region. For the connection region, when theterminal is located in the connection region, the user using theterminal has multiple optional paths. Therefore, the predicted locationsof the first location should include all geographical regions that areconnected to the connection region. In a connection region in aninstance shown in FIG. 4, a current location point, that is, a firstlocation point, of the terminal is a point 0. The connection regionconnects two bidirectional corridors, the user may perform bidirectionalmovement along either bidirectional corridor connected to the connectionregion, or may keep still. Therefore, the terminal may be located at apoint 1, a point 2, a point 3, or a point 4, or may be still located atthe point 0 at the next moment. That is, predicted location points ofthe first location are the points 0, 1, 2, 3, and 4.

For still another example, the terminal determines that the geographicalregion type of the geographical region in which the first location islocated is a plaza. For the plaza, the user using the terminal may walkin any direction. Therefore, the predicted locations of the firstlocation are a proximity location in each direction of the firstlocation. In a plaza in an instance shown in FIG. 5, a current locationpoint, that is, a first location point, of the terminal is a point 0. Inthe plaza, the user may move along any direction of the current locationpoint, or may keep still. Therefore, the terminal may be located at apoint 1, a point 2, a point 3, a point 4, a point 5, a point 6, a point7, or a point 8, or may be still located at the point 0 at the nextmoment. That is, predicted location points of the first location are thepoints 0, 1, 2, 3, 4, 5, 6, 7, and 8.

A second manner is as follows: The terminal obtains the type of thegeographical region in which the first location is located and ahistorical movement speed of the terminal, and obtains, according to thetype of the geographical region in which the first location is locatedand the historical movement speed of the terminal, all the predictedlocations corresponding to the first location.

In the foregoing second manner, the terminal determines the geographicalregion type of the geographical region in which the first location islocated, and determines, according to the region type, directions of allthe predicted locations that are corresponding to the first location andthat are located in the geographical region in which the first locationis located. Further, the terminal determines a quantity of predictedlocations based on a historical movement speed of the terminal at thefirst location and a historical movement speed of the terminal previousto the first location.

For example, the terminal determines that the geographical region typeof the geographical region in which the first location is located is aconnection region. For the connection region, when the terminal islocated in the connection region, the user using the terminal hasmultiple optional paths. Therefore, the predicted locations of the firstlocation should include all geographical regions that are connected tothe connection region. In a connection region in an instance shown inFIG. 6, the user has optional paths in four directions. Further, theterminal may determine, according to the historical movement speed ofthe terminal, a quantity of predicted location points distributed ineach direction. A higher historical movement speed of the terminal iscorresponding to a larger quantity of predicted location points of thefirst location. It is assumed that a movement speed V1 of the terminalat the first location is greater than a preset threshold V0 and is lessthan twice of V0. Then, a quantity of predicted locations distributed ineach direction of an optional path is twice of the quantity when themovement speed is less than the threshold. A current location point,that is, a first location point, of the terminal is a point 0.Therefore, the predicted location points of the first location arepoints 0, 1, 2, 3, 4, 5, 6, 7, and 8.

Step 102: The terminal obtains, according to historical movementinformation of the terminal, a first probability corresponding to eachpredicted location.

A first probability corresponding to a first predicted location is aprobability obtained according to the historical movement information ofthe terminal by predicting that the terminal is located at the firstpredicted location at a second moment. The first predicted location isany one of all the predicted locations. The second moment is later thanthe first moment.

Specifically, the historical movement information of the terminalincludes at least one or a combination of the following: a movementlocation of the terminal in a preset period previous to the firstmoment, a movement speed of the terminal in the preset period previousto the first moment, or a movement direction of the terminal in thepreset period previous to the first moment.

Further, the terminal can obtain a correspondence between each predictedlocation, a location change, and a movement status based on thehistorical movement speed of the terminal and the first location. Table2 shows a correspondence between a predicted location, a locationchange, and a movement status in the corridor shown in FIG. 3.

TABLE 2 Predicted location point Movement status Location change 2 Keepmoving ahead 0 → 2 0 Keep still 0 → 0 1 Move back 0 → 1

In the bidirectional corridor shown in FIG. 3, the current positioninglocation point, that is, the first location point, of the terminal isthe point 0. Therefore, the predicted location points of the firstlocation are the points 0, 1, and 2. It can be learned from thehistorical movement information of the terminal that a positioninglocation point at a previous moment is the point 1, and a movementdirection of the user is 1→0. Different predicted positioning locationpoints are corresponding to different movement statuses. For example, alocation change 0→2 means that a movement status of the user is to keepmoving ahead. Likewise, a location change 0→0 means that a movementstatus of the user is to keep still at the point 0; and a locationchange 0→1 means that the user moves back.

Table 3 shows a correspondence between a predicted location, a locationchange, and a movement status in the connection region shown in FIG. 4.

TABLE 3 Predicted location point Movement status Location change 3 Keepmoving ahead 0 → 3 0 Keep still 0 → 0 1 Move back 0 → 1 4 Turn left 0 →4 5 Turn right 0 → 5

In the connection region in the instance shown in FIG. 4, the currentpositioning location point, that is, the first location point, is thepoint 0. Therefore, the predicted location points of the first locationare the points 0, 1, 2, 3, and 4. It can be learned from the historicalmovement information of the terminal that a positioning location pointat a previous moment is the point 1, and a movement direction of theuser is 1→0. Likewise, different predicted positioning location pointsare corresponding to different movement statuses. That is, a locationchange 0→3 means that the user keeps moving ahead, 0→0 means that theuser keeps still at the point 0, 0→1 means that the user moves back, 0→4means that the user turns left, and 0→2 means that the user turns right.

Table 4 shows a correspondence between a predicted location, a locationchange, and a movement status in the plaza shown in FIG. 5.

TABLE 4 Predicted location point Movement status Location change 5 Keepmoving ahead 0 → 5 0 Keep still 0 → 0 1 Move back 0 → 1 4 Left front 0 →4 6 Right front 0 → 6 3 Turn left 0 → 3 7 Turn right 0 → 7 2 Left rear 0→ 2 8 Right rear 0 → 8

In the plaza in the instance shown in FIG. 5, the current positioninglocation point, that is, the first location point, is the point 0.Therefore, the predicted location points of the first location are thepoints 0, 1, 2, 3, 4, 5, 6, 7, and 8. It can be learned from thehistorical movement information of the terminal that a positioninglocation point at a previous moment is the point 1, and a movementdirection of the user is 1→0. Selected predicted positioning locationpoints are adjacent positioning location points in eight directionssurrounding the point 0. Therefore, the predicted positioning locationpoints are nine points: the point 0 to the point 8. Likewise, locationchanges at different predicted positioning location points arecorresponding to different movement statuses.

It can be learned that different predicted locations are correspondingto different movement directions and movement statuses of the terminalat the next moment, and not all occurrence probabilities of thesemovement statuses are the same. Therefore, an occurrence probabilitythat the terminal passes through each predicted location in all theforegoing predicted locations is also different. In step 202, theterminal predicts, according to the historical movement information ofthe terminal, the first probability that the terminal passes througheach predicted location in all the predicted locations.

Specifically, the following two inferences may be used for calculationto predict the first probability that the terminal passes through eachpredicted location in all the predicted locations: 1. A probability thata walking direction of the user remains unchanged in a period of time isrelatively high. That is, if the user using the terminal has moved aheadin a direction in a previous period of time, a probability that the userkeeps moving ahead in the direction at a next moment is relatively high.2. A probability that a walking speed of the user using the terminalkeeps slight fluctuation in a period of time is relatively high. Thatis, a person is prone to walk at a constant speed during walking, andthe walking speed slightly fluctuates in a range. Occurrenceprobabilities that different terminals pass through different predictedlocations may be obtained based on the foregoing two inferences andcorrespondences between movement statuses and predicted locations of theterminals. FIG. 7 shows a schematic diagram of a specific instance of afirst probability calculated for each predicted location in abidirectional corridor.

It can be learned from FIG. 7 that a location point of the terminal at acurrent moment is a point 0. It can be learned from the historicalmovement information of the terminal that a historical movement track ofthe terminal in a preset period previous to the current moment is−3→−2→−1→0, and the user using the terminal walks to the left (adirection from a point −3 to a point 3) in the rectilinear corridor. Thepredicted location points of the first location are obtained accordingto the type of the geographical region in which the first location islocated and the movement speed of the terminal and are seven positioninglocation points: points −3, −2, −1, 0, 1, 2, and 3. Different predictedlocation points are corresponding to different movement statuses. Thatis, the point 1 (0→1) represents that the user keeps moving ahead at anoriginal speed. This case is continuations of a movement status and amovement trend of the current terminal. Therefore, an occurrenceprobability is highest, and the occurrence probability corresponding tothe point 1 is indicated as P1. The point 2 (0→2) represents that theuser using the terminal moves ahead in the movement direction at a speedtwice the original speed. An occurrence probability is medium, and theoccurrence probability corresponding to the point 2 is indicated as P2.The point 3 (0→3) represents that the user moves ahead in the movementdirection at a speed three times the original speed. Because the speedchanges dramatically, an occurrence probability is low, and theoccurrence probability corresponding to the point 3 is indicated as P3.A point 4 (0→4) represents that the user keeps still at the point 0. Anoccurrence probability is medium, and the occurrence probabilitycorresponding to the point 4 is indicated as P4. The point −1 (0→−1)represents that the user using the terminal changes the originalmovement direction to move back, and walks at the original speed. Anoccurrence probability is medium, and the occurrence probabilitycorresponding to the point −1 is indicated as P1′. The point −2 (0→−2)represents that the user using the terminal changes the original walkingdirection to move back, and walks at a speed twice the original speed.An occurrence probability is low, and the occurrence probabilitycorresponding to the point −2 is indicated as P2′. The point −3 (0→−3)represents that the user using the terminal changes the original walkingdirection to move back, and walks at a speed three times the originalspeed. An occurrence probability is lowest, and the occurrenceprobability corresponding to the point −3 is indicated as P3′. Foranother positioning location point in the positioning region, a distancebetween the another positioning location point and a current location isrelatively long. It may be considered that the user is unlikely to moveto the another positioning location point at the next positioningmoment. Therefore, the another positioning location point is not apredicted location point.

According to the foregoing analysis, a magnitude sequence of theoccurrence probabilities corresponding to all the predicted locationpoints may be obtained, that is, P1>P2=P4=P1′>P3=P2′>P3′. In theinstance in FIG. 7, magnitudes of the occurrence probabilities that theuser walks from the first location to the predicted locations may be setin a multiple relationship, that is, P1=2P2=4P3=8P3′. Certainly, suchspecific values may also be specifically set according to an actualcase. Therefore, in the instance, the occurrence probability P1 of 0→1is equal to 0.32, the occurrence probability P2 of 0→2 is equal to 0.16,the occurrence probability P3 of 0→3 is equal to 0.08, the occurrenceprobability P4 of 0→0 is equal to 0.16, the occurrence probability P1′of 0→−1 is equal to 0.16, the occurrence probability P2′ of 0→−2 isequal to 0.08, and the occurrence probability P3′ of 0→−3 is equal to0.04.

Step 103: The terminal obtains signal strength of at least one wirelesssignal received by the terminal at a second moment.

Step 104: The terminal obtains, according to the signal strength of theat least one wireless signal, a second probability corresponding to eachpredicted location.

A second probability corresponding to the first predicted location is aprobability that is obtained according to the signal strength of the atleast one wireless signal and that indicates that the terminal islocated at the first predicted location at the second moment.

The terminal may receive, at the second moment, wireless signals sent bymultiple wireless signal transmitters (Wi-Fi APs or BLE Beacons). Theterminal extracts RSSI features according to signal strength of thereceived wireless signals, and obtains, according to the RSSI features,a probability corresponding to a location of the terminal at the secondmoment. The probability is referred to as an RSSI feature probability.The RSSI features herein may be classified into two types: an RSSIabsolute value and an RSSI size relationship.

RSSI absolute value: The RSSI absolute value can reflect a distancebetween a positioning location and a nearest wireless signaltransmitter. Field test data shows that, when a linear distance betweenthe terminal and the transmitter is within 1 m, an RSSI value receivedis maximum with a small change amplitude, and basically can remainstable at −55 to −60 dBm (decibel-milliwatt); and when the distance isgreater than 2 m, the RSSI is greatly reduced to below −70 dBm, and thechanging amplitude begins to increase. Therefore, when the wirelesssignals received by the terminal include a signal with an RSSI absolutevalue greater than −60 dBm, the positioning location falls within arange quite near a location of a wireless transmitter corresponding tothe positioning location.

RSSI magnitude relationship: In a terminal positioning process, theterminal receives wireless signals sent by multiple wireless signaltransmitters. RSSIs of these wireless signals form a magnituderelationship. Generally, a transmitter with a larger RSSI value isnearer to a user location. However, because of impact of multipleinterference factors such as a body block and traffic, such acorrespondence becomes unstable.

Further, after the probability corresponding to the location of theterminal is obtained according to the RSSIs of the received wirelesssignals, RSSI feature space probability distribution is usuallygenerated by using a sample training method. A specific process is asfollows: First, several sample location points are selected in acoverage area in which a wireless signal transmitter used for indoorpositioning has already been deployed. RSSIs of signals transmitted bythe wireless transmitter are collected from these sample locationpoints, to obtain RSSIs of wireless signals received by the terminal anda training sample of such a correspondence at the location of theterminal. During specific implementation, signal collection should beperformed multiple times at a same sample location point, to ensure atraining sample size. Generally, a larger sample size indicates that atraining result can reflect more about an occurrence probabilitycorresponding to a positioning location in an actual case, and sampletraining reliability is also higher. After collection of trainingsamples is completed, RSSI features of the training samples areextracted, that is, the foregoing two RSSI features: the RSSI absolutevalue and the RSSI magnitude relationship. It is assumed that an indoorregion covers four wireless signal transmitters. In this case, specificRSSI features are as follows: Feature 1 is that a wireless transmitter 1has a maximum RSSI and has an RSSI absolute value greater than −60 dBm;feature 2 is that a wireless transmitter 2 has a maximum RSSI and has anRSSI absolute value greater than −60 dBm; and feature 3 is that wirelesstransmitters 1 and 2 have RSSIs greater than RSSIs of signals of othertransmitters and the transmitters 1 and 2 have RSSI absolute valuesfalling within a range from −60 to −70 dBm, and so on. After these RSSIfeatures are extracted, each sample data satisfying a particular RSSIfeature is screened out from the training samples, and a quantity of thesample data falling within a specific location range is counted. RSSIfeature space probability distribution shown in FIG. 8 is used as anexample. A total of 10000 training samples are collected in a samplecollection phase, and a total of 320 training samples satisfying thefeature 1 are screened out. In the 320 training samples, distancesbetween collection location points of 280 training samples and adeployment location of the transmitter 1 fall within 5 meters, distancesbetween collection location points of 25 training samples and thedeployment location of the transmitter 1 fall within a range from 5meters to 10 meters, and distances between collection location points ofonly 15 training samples and the deployment location of the transmitter1 fall beyond 10 meters. In this way, space probability distribution atthe location can be obtained according to the collected RSSIs, that is,the RSSI feature space probability distribution is generated. In thiscase, when an RSSI of a signal collected by the terminal satisfies thefeature 1, that is, the transmitter 1 has the maximum RSSI and has theRSSI absolute value greater than −60 dBm, RSSI feature space probabilitydistribution corresponding to the terminal can be obtained as follows: Aprobability that the distances to the deployment location of thetransmitter 1 fall within 5 meters is 280/320=0.875; a probability thatthe distances to the deployment location of the transmitter 1 fallwithin the range from 5 meters to 10 meters is 25/320=0.078175; and aprobability that the distances to the deployment location of thetransmitter 1 fall beyond 10 meters is 15/320=0.046875. Likewise, RSSIfeature space probability distribution corresponding to the feature 2,the feature 3, and all other features can be obtained by using theforegoing method. It should be noted that, in different indoorpositioning places, factors such as deployment density, a deploymentmanner, and transmit power of wireless signal transmitters aredifferent. Therefore, constructed training samples are merely used in aparticular indoor positioning coverage area and are not ageneral-purpose training sample library.

Next, the terminal maps each predicted location onto a location point inthe RSSI feature space probability distribution, that is, finds, in theRSSI feature space probability distribution, a location coordinate pointcorresponding to each predicted location, and obtains, according tospecific location coordinates of each predicted location, the secondprobability corresponding to each predicted location. For example, inthe instance in FIG. 7, a distance between the predicted location point1 and the deployment location of the transmitter 1 falls within 5meters. Therefore, a second probability corresponding to the predictedlocation 1 is 0.875.

Step 105: The terminal obtains, according to the first probability andthe second probability that are corresponding to each predictedlocation, a third probability corresponding to each predicted location.

Optionally, obtaining, according to the first probability and the secondprobability that are corresponding to each predicted location, the thirdprobability corresponding to each predicted location specificallyincludes the following implementations:

Manner 1: The terminal performs weighted summation on the firstprobability and the second probability that are corresponding to eachpredicted location, to obtain the third probability corresponding toeach predicted location.

For example, in the instance in FIG. 7, an occurrence probability thatthe terminal passes through a predicted location, that is, the firstprobability and the second probability that is corresponding to eachpredicted location and that is obtained by using the RSSI feature spaceprobability distribution are considered comprehensively, to finallyobtain the third probability corresponding to each predicted location. Aspecific process is as follows: The terminal determines a specificcoordinate location point of each predicted location in the RSSI featurespace probability distribution, further obtains an RSSI featureprobability corresponding to each predicted location, that is, thesecond probability, and obtains the third probability by performingweighted summation on the first probability and the second probability.Assuming that weights of the first probability and the secondprobability are set to 0.5, the third probability obtained by means ofweighted summation=first probability×0.5+second probability×0.5. For aspecific result, refer to Table 5. Different weight values of the firstprobability and the second probability may be set according to an actualcase.

TABLE 5 Second Third Predicted probability probability Movement locationFirst (RSSI feature (weighted status point probability probability)summation) Move ahead at 1 0.32 0.62 0.47 an original speed Move aheadat a 2 0.16 0.58 0.35 speed twice the original speed Move ahead at a 30.08 0.37 0.275 speed twice the original speed, and then turn right Keepstill 0 0.16 0.55 0.355 Move back at −1 0.16 0.36 0.26 the originalspeed Move back at a −2 0.08 0.22 0.15 speed twice the original speedMove back at a −3 0.04 0 0.02 speed three times the original speed

Manner 2: The terminal multiplies the first probability and the secondprobability that are corresponding to each predicted location, to obtainthe third probability corresponding to each predicted location.

For example, in the instance in FIG. 7, an occurrence probability thatthe terminal passes through a predicted location, that is, the firstprobability and the second probability that is corresponding to eachpredicted location and that is obtained by using the RSSI feature spaceprobability distribution are considered comprehensively, to finallyobtain the third probability corresponding to each predicted location. Aspecific process is as follows: The terminal determines a specificcoordinate location point of each predicted location in the RSSI featurespace probability distribution, further obtains an RSSI featureprobability corresponding to each predicted location, that is, thesecond probability, and obtains the third probability by multiplying thefirst probability and the second probability. For a specific result,refer to Table 6.

TABLE 6 Second probability Third Movement Predicted First (RSSI featureprobability status location point probability probability) (product)Move ahead at 1 0.32 0.62 0.1984 an original speed Move ahead at 2 0.160.58 0.0928 a speed twice the original speed Move ahead at 3 0.08 0.370.0296 a speed twice the original speed, and then turn right Keep still0 0.16 0.55 0.0880 Move back at −1 0.16 0.36 0.0576 the original speedMove back at −2 0.08 0.22 0.0176 a speed twice the original speed Moveback at −3 0.04 0 0 a speed three times the original speed

Step 106: The terminal determines a predicted location with a highestthird probability in all the predicted locations as a second location ofthe terminal at the second moment.

It can be learned from the foregoing instance in FIG. 7 that a thirdprobability corresponding to the predicted location point 1 is highest.Therefore, the point 1 is determined as the location of the terminal atthe second moment.

Based on a same inventive concept as the embodiment shown in FIG. 1, anembodiment of the present invention further provides a terminal havingan indoor positioning function. The terminal may be a mobile phone, atablet computer (Tablet Personal Computer), a laptop computer (LaptopComputer), a multimedia player, a digital camera, a personal digitalassistant (personal digital assistant, PDA), a navigation apparatus, amobile Internet device (Mobile Internet Device, MID), a wearable device(Wearable Device), or the like.

FIG. 9 shows a specific implementation of a terminal according to anembodiment of the present invention. The terminal includes acommunications device 901, a processor 902, a memory 903, a sensor 904,an input unit 905, an output unit 906, and a peripheral interface 907.The communications device 901, the processor 902, the memory 903, thesensor 904, the input unit 905, the output unit 906, and the peripheralinterface 907 are connected to each other. This embodiment of thepresent invention imposes no limitation on a specific connection mediumbetween the foregoing components. In this embodiment of the presentinvention, the communications device 901, the processor 902, the memory903, the sensor 904, the input unit 905, the output unit 906, and theperipheral interface 907 in FIG. 9 are connected by using a bus 908. Thebus is represented by one bold line in FIG. 9. A connection mannerbetween other components is merely an example for description and is notlimited herein. The bus may be classified into an address bus, a databus, a control bus, and the like. For ease of denotation, the bus isrepresented by only one bold line in FIG. 9; however, it does notindicate that there is only one bus or one type of bus.

A structure of the terminal shown in FIG. 9 constitutes no limitation onthe present invention. The terminal may be a bus structure or a starstructure. Alternatively, the terminal may include components more orfewer than those in FIG. 9, a combination of some components, orcomponents deployed differently.

In this embodiment of the present invention, the communications device901 is configured to send and receive a wireless signal.

The sensor 904 is configured to obtain movement information of theterminal.

The processor 902 is configured to: obtain a first location of theterminal at a first moment; obtain all predicted locations correspondingto the first location; obtain, according to historical movementinformation of the terminal, a first probability corresponding to eachpredicted location; obtain signal strength of at least one wirelesssignal received by the communications device at the second moment;obtain, according to the signal strength of the at least one wirelesssignal, a second probability corresponding to each predicted location;obtain, according to the first probability and the second probabilitythat are corresponding to each predicted location, a third probabilitycorresponding to each predicted location; and determine a predictedlocation with a highest third probability in all the predicted locationsas a second location of the terminal at the second moment; where all thepredicted locations include at least two predicted locations, a firstprobability corresponding to a first predicted location is a probabilityobtained according to the historical movement information of theterminal by predicting that the terminal is located at the firstpredicted location at the second moment, the first predicted location isany one of all the predicted locations, the second moment is later thanthe first moment, and a second probability corresponding to the firstpredicted location is a probability that is obtained according to thesignal strength of the at least one wireless signal and that indicatesthat the terminal is located at the first predicted location at thesecond moment.

The memory 903 in this embodiment of the present invention is configuredto store program code executed by the processor 902. The memory 903mainly includes a program storage area and a data storage area. Theprogram storage area may store an operating system, an applicationprogram required by at least one function, such as a sound playingprogram or an image playing program, and the like. The data storage areamay store data created according to use of the terminal, such as audiodata and a phone book. In a specific implementation of this embodimentof the present invention, the memory 903 may include a volatile memorysuch as a nonvolatile dynamic random access memory (Nonvolatile RandomAccess Memory, NVRAM), a phase change random access memory (Phase ChangeRAM, PRAM), or a magnetoresistive random access memory (MagetoresistiveRAM, MRAM), or may include a nonvolatile memory such as at least onemagnetic disk storage component, an electrically erasable programmableread-only memory (Electrically Erasable Programmable Read-Only Memory,EEPROM), or a flash memory component, for example, a NOR flash memory(NOR flash memory) or a NAND flash memory (NAND flash memory).Alternatively, the memory 903 is, but not limited to, any other mediumthat can be used to carry or store expected program code in a form of aninstruction or a data structure and can be accessed by a computer. Thememory 903 may be a combination of the foregoing memories.

The nonvolatile memory stores an operating system and an applicationprogram that are executed by the processor 902. The processor 902 loadsa running program and data from the nonvolatile memory into a memory andstores digital content into a large-capacity storage apparatus. Theoperating system includes a conventional system task used for controland management, such as memory management, storage device control, andpower management, and various components and/or drives facilitatingcommunication between various software and hardware. In animplementation of the present invention, the operating system may beAndroid (Android system), an iOS system, a Windows operating system, orthe like, or may be an embedded operating system such as Vxworks.

The application program includes any application installed on theterminal, including but not limited to a browser, an email, an instantmessage service, word processing, keyboard virtualization, a widget(Widget), encryption, digital copyright management, speech recognition,speech reproduction, positioning, music playback, or the like.

The processor 902 in this embodiment of the present invention isconnected to all parts of the entire terminal by using variousinterfaces and cables, runs or executes a software program and/or amodule stored in a storage unit, and invokes data stored in the memory901, to perform the method shown in FIG. 1. The processor 902 mayinclude an integrated circuit (Integrated Circuit, IC), for example, mayinclude a single packaged IC or may include multiple connected packagedICs with a same function or different functions. For example, theprocessor 902 may include only a central processing unit (CentralProcessing Unit, CPU), or may be a combination of a CPU, a digitalsignal processor (Digital Signal Processor, DSP), and a control chipsuch as a baseband chip in the communications device 901. In animplementation of the present invention, the CPU may be asingle-operation core, or may include a multi-operation core.

The communications device 901 in this embodiment of the presentinvention is mainly configured to send and receive a wireless signal.The communications device 901 is further configured to establish acommunications channel, so that the terminal is connected to a remoteserver by using the communications channel and downloads media data fromthe remote server. The communications device 901 may include acommunications module, such as a wireless local area network (WirelessLocal Area Network, wireless LAN for short) module, a Bluetooth module,or a baseband (Base Band) module, and a radio frequency (RadioFrequency, RF for short) circuit corresponding to the communicationsmodule. The communications device 901 is configured to perform wirelesslocal area network communication, Bluetooth communication, infraredcommunication, and/or cellular communications system communication, forexample, Wideband Code Division Multiple Access (Wideband Code DivisionMultiple Access, W-CDMA for short) and/or High Speed Downlink PacketAccess (High Speed Downlink Packet Access, HSDPA for short). Thecommunications module is configured to control communication betweencomponents in the terminal and may support direct memory access (DirectMemory Access).

In different implementations of the present invention, variouscommunications modules in the communications device 901 are generallyimplemented in a form of an integrated circuit chip (Integrated CircuitChip), and may be selectively combined. However, the communicationsdevice 901 does not need to include all communications module and acorresponding antenna group. For example, the communications device 901may include only a baseband chip, a radio frequency chip, and acorresponding antenna, to provide a communication function in a cellularcommunications system. The terminal may be connected to a cellularnetwork (Cellular Network) or the Internet (Internet) by using awireless communication connection established by the communicationsdevice 901, for example, wireless local area network access or WCDMAaccess. In some optional implementations of the present invention, thecommunications module, for example, the baseband module, in thecommunications device 901 may be integrated into the processor 902.

The radio frequency circuit is configured to send and receiveinformation or send and receive a signal during a call. For example,after receiving downlink information of a base station, the radiofrequency circuit sends the downlink information to a processing unitfor processing. In addition, the radio frequency circuit sends uplinkdata to the base station. Generally, the radio frequency circuitincludes a well-known circuit configured to perform these functions,including but not limited to an antenna system, a radio frequencytransceiver, one or more amplifiers, a tuner, one or more oscillators, adigital signal processor, a codec (Codec) chipset, a subscriber identitymodule (SIM) card, a memory, and the like. In addition, the radiofrequency circuit may further communicate with a network and anotherdevice by means of wireless communication. In the wirelesscommunication, any communication standard or protocol may be used,including but not limited to a global system for mobile communications(Global System of Mobile communication, GSM), a general packet radioservice (General Packet Radio Service, GPRS), Code Division MultipleAccess (Code Division Multiple Access, CDMA), WCDMA (Wideband CodeDivision Multiple Access, Wideband Code Division Multiple Access), aHigh Speed Uplink Packet Access (High Speed Uplink Packet Access, HSUPA)technology, LTE (Long Term Evolution, Long Term Evolution), an email, anSMS (Short Messaging Service, short message service), and the like.

The input unit 905 in this embodiment of the present invention isconfigured to: implement interaction between a user and the terminal,and/or input information into the terminal. For example, the input unit905 may receive digit or character information input by the user, togenerate signal input related to a user configuration or functioncontrol. In a specific implementation of the present invention, theinput unit 905 may be a touch panel, or may be another human-machineinteraction interface, for example, a substantive input key or amicrophone, or may be another external-information capture apparatus,for example, a camera. The touch panel is also referred to as atouchscreen or a touch control screen and may collect a touch orproximity operation of the user. For example, the user uses anyappropriate object or accessory, such as a finger or a stylus, toperform an operation on the touch panel or at a location in proximity ofthe touch panel, and drive a corresponding connection apparatusaccording to a preset program. Optionally, the touch panel may includetwo parts: a touch detection apparatus and a touch controller. The touchdetection apparatus detects a touch operation of the user, converts thedetected touch operation into an electrical signal, and transmits theelectrical signal to the touch controller. The touch controller receivesthe electrical signal from the touch detection apparatus, converts theelectrical signal into contact coordinates, and then sends the contactcoordinates to the processor 902. The touch controller may furtherreceive and execute a command sent by the processor 902. In addition,the touch panel may be implemented in multiple types such as a resistivetype, a capacitive type, an infrared (Infrared) type, and a surfaceacoustic wave type. In another implementation of the present invention,the substantive input key used by the input unit 905 may include but isnot limited to one of or a combination of a physical keyboard, afunction key such as a volume control button or a switch button, atrackball, a mouse, a joystick, or the like. The input unit 905 in amicrophone form may collect a voice input by the user or an environmentand convert the voice into a command that is in an electrical signalform and that can be executed by the processor 902.

The sensor 904 in this embodiment of the present invention is configuredto obtain the movement information of the terminal. The sensor 904 maybe various sensor devices, for example, a hall element, and isconfigured to: sense a physical quantity of an electronic device, suchas force, moment of force, pressure, stress, a location, displacement, aspeed, acceleration, an angle, an angular velocity, a quantity ofrevolutions, a revolving speed, operating status change time, or thelike, and convert the physical quantity into an electrical quantity fordetection and control. Some other sensor devices may further include agravity sensor, a tri-axis accelerometer, a gyroscope, and the like. Insome optional implementations of the present invention, the sensor 904may be integrated into the input unit 905.

The output unit 906 in this embodiment of the present invention isconfigured to output a text, an image, and/or video. The output unit 906includes but is not limited to an image output unit and a sound outputunit. The image output unit may include a display panel, such as adisplay panel configured in a form of a liquid crystal display (LiquidCrystal Display, LCD), an organic light-emitting diode (OrganicLight-Emitting Diode, OLED), a field emission display (field emissiondisplay, FED), or the like. Alternatively, the image output unit mayinclude a reflective display, such as an electrophoretic(electrophoretic) display, or a display using an interferometricmodulation of light (Interferometric Modulation of Light) technology.The image output unit may include a single display or multiple displaysin different sizes. In a specific implementation of the presentinvention, the touch panel used by the input unit 905 may also be usedas the display panel of the output unit 906 simultaneously. For example,after detecting a touch or proximity gesture operation on the touchpanel, the touch panel transmits the gesture operation to the processor902 to determine a touch event type. Then, the processor 902 providescorresponding visual output on the display panel according to the touchevent type. In FIG. 9, the input unit 905 and the output unit 906 areused as two independent components to implement input and outputfunctions of the electronic device; however, in some embodiments, atouch panel and a display panel may be integrated to implement input andoutput functions of the terminal. For example, the image output unit maydisplay various graphical user interfaces (Graphical User Interface,GUI) used as virtual control components, including but not limited to awindow, a scroll bar, an icon, and a clipboard, so that the userperforms an operation in a touch control manner.

In a specific implementation of the present invention, the image outputunit includes a filter and an amplifier, configured to filter andamplify video output by the processing unit. The audio output unitincludes a digital-to-analog converter, configured to convert an audiosignal, output by the processor 901, from a digital format into ananalog format.

The terminal in this embodiment of the present invention furtherincludes a power unit 909, configured to supply power to differentcomponents of the terminal, so as to maintain running of the terminal.Generally, it is understood that the power unit 909 may be an internalbattery such as a common lithium-ion battery or a common NiMH battery,or may include an external power supply that directly supplies power tothe terminal, for example, an AC adapter. In some implementations of thepresent invention, the power unit 909 may further have a broaderdefinition, for example, may further include a power management system,a charging system, a power failure detection circuit, a power converteror inverter, a power status indicator such as a light emitting diode,and any other component related to power generation, management, anddistribution of the electronic device.

In conclusion, in this embodiment of the present invention, the terminalobtains all predicted locations of a current location, predicts,according to the historical movement information of the terminal, afirst probability that the terminal passes through each predictedlocation at a next moment, receives a wireless signal sent by apositioning transmitter, obtains, based on strength of the receivedsignal, a second probability that the terminal passes through eachpredicted location at the next moment, generates, according to the firstprobability and the second probability that are corresponding to eachpredicted location, a third probability corresponding to each predictedlocation, and determines a predicted location point with a highest thirdprobability as a location of the terminal at the second moment. In thisway, in a terminal positioning process, a positioning location of theterminal is predicted by comprehensively analyzing the historicalmovement information of the terminal and the strength of the wirelesssignal received by the terminal, instead of simply depending on thestrength of the wireless signal received by the terminal. In theterminal positioning process, the historical movement information of theterminal is used to calculate an occurrence probability corresponding toa predicted location. Therefore, jump of the positioning location can beavoided, continuity of the positioning location of the terminal isensured, user experience is improved, and positioning accuracy can beimproved.

Persons skilled in the art should understand that the embodiments of thepresent invention may be provided as a method, a system, or a computerprogram product. Therefore, the present invention may use a form ofhardware only embodiments, software only embodiments, or embodimentswith a combination of software and hardware. Moreover, the presentinvention may use a form of a computer program product that isimplemented on one or more computer-usable storage media (including butnot limited to a disk memory, a CD-ROM, an optical memory, and the like)that include computer-usable program code.

The present invention is described with reference to the flowchartsand/or block diagrams of the method, the device (system), and thecomputer program product according to the embodiments of the presentinvention. It should be understood that computer program instructionsmay be used to implement each process and/or each block in theflowcharts and/or the block diagrams and a combination of a processand/or a block in the flowcharts and/or the block diagrams. Thesecomputer program instructions may be provided for a general-purposecomputer, a dedicated computer, an embedded processor, or a processor ofany other programmable data processing device to generate a machine, sothat the instructions executed by a computer or a processor of any otherprogrammable data processing device generate an apparatus forimplementing a specific function in one or more processes in theflowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions may also be stored in a computerreadable memory that can instruct the computer or any other programmabledata processing device to work in a specific manner, so that theinstructions stored in the computer readable memory generate an artifactthat includes an instruction apparatus. The instruction apparatusimplements a specific function in one or more processes in theflowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions may also be loaded onto a computeror another programmable data processing device, so that a series ofoperations and steps are performed on the computer or the anotherprogrammable device, thereby generating computer-implemented processing.Therefore, the instructions executed on the computer or the anotherprogrammable device provide steps for implementing a specific functionin one or more processes in the flowcharts and/or in one or more blocksin the block diagrams.

Although embodiments of the present invention have been described,persons skilled in the art can make changes and modifications to theseembodiments once they learn the basic inventive concept. Therefore, thefollowing claims are intended to be construed as to cover the preferredembodiments and all changes and modifications falling within the scopeof the present invention.

Obviously, persons skilled in the art can make various modifications andvariations to the embodiments of the present invention without departingfrom the spirit and scope of the embodiments of the present invention.The present invention is intended to cover these modifications andvariations provided that they fall within the scope of protectiondefined by the following claims and their equivalent technologies.

1. An indoor positioning method, comprising: obtaining, by a terminal, afirst location of the terminal at a first moment; obtaining, by theterminal, a plurality of predicted locations corresponding to the firstlocation; for each predicted location of the plurality of predictedlocations, obtaining, by the terminal according to historical movementinformation of the terminal, a first probability corresponding to thepredicted location, wherein the first probability corresponding to thepredicted location is a probability that the terminal is located at thepredicted location at a second moment and the first probability isobtained according to the historical movement information of theterminal, and the second moment is later than the first moment;obtaining, by the terminal, signal strength of at least one wirelesssignal received by the terminal at the second moment; obtaining, by theterminal according to the signal strength of the at least one wirelesssignal, a second probability corresponding to the predicted location;wherein the second probability corresponding to the predicted locationis a probability that the terminal is located at the predicted locationat the second moment and the second probability is obtained according tothe signal strength of the at least one wireless signal; obtaining, bythe terminal according to the first probability and the secondprobability that are corresponding to the predicted location, a thirdprobability corresponding to the predicted location; and determining, bythe terminal, a predicted location with a highest third probability inthe plurality of predicted locations as a second location of theterminal at the second moment.
 2. The method according to claim 1,wherein the obtaining, by the terminal, a plurality of predictedlocations corresponding to the first location comprises: obtaining, bythe terminal, a type of a geographical region in which the firstlocation is located; and obtaining, by the terminal according to thetype of the geographical region in which the first location is located,the plurality of predicted locations corresponding to the firstlocation.
 3. The method according to claim 2, wherein the geographicalregion type comprises at least one of a unidirectional corridor, abidirectional corridor, a unidirectional arc-shaped corridor, abidirectional arc-shaped corridor, a plaza, or a connection region;wherein: the unidirectional corridor is a rectilinear corridor allowinga pedestrian to walk in one direction; the bidirectional corridor is arectilinear corridor allowing a pedestrian to walk in both directions;the unidirectional arc-shaped corridor is an arc-shaped corridorallowing a pedestrian to walk in one direction; the bidirectionalarc-shaped corridor is an arc-shaped corridor allowing a pedestrian towalk in both directions; the plaza is a region in which a walkingdirection of a pedestrian is not restricted; and the connection regionis a region connecting at least two geographical regions.
 4. The methodaccording to claim 1, wherein the historical movement information of theterminal comprises at least one of the following: a movement location ofthe terminal in a preset period previous to the first moment, a movementspeed of the terminal in the preset period previous to the first moment,or a movement direction of the terminal in the preset period previous tothe first moment.
 5. The method according to claim 1, wherein theobtaining, by the terminal according to the first probability and thesecond probability that are corresponding to the predicted location, athird probability corresponding to the predicted location comprises:performing, by the terminal, weighted summation on the first probabilityand the second probability that are corresponding to the predictedlocation, to obtain the third probability corresponding to the predictedlocation.
 6. A terminal, comprising: a transceiver configured to sendand receive a wireless signal; a sensor, configured to obtain movementinformation of the terminal; at least one processor; and anon-transitory computer readable storage medium coupled to the at leastone processor and storing computer-executable codes which, whenexecuted, cause the terminal to: obtain a first location of the terminalat a first moment; obtain a plurality of predicted locationscorresponding to the first location; obtain, according to historicalmovement information of the terminal, a first probability correspondingto each predicted location of the plurality of predicted locations;obtain signal strength of at least one wireless signal received by thecommunications device at a second moment; obtain, according to thesignal strength of the at least one wireless signal, a secondprobability corresponding to each predicted location of the plurality ofpredicted locations; obtain, according to the first probability and thesecond probability that are corresponding to each predicted location, athird probability corresponding to each predicted location of theplurality of predicted locations; and determine a predicted locationwith a highest third probability in the plurality of predicted locationsas a second location of the terminal at the second moment; wherein: thefirst probability corresponding to the predicted location is aprobability that the terminal is located at the predicted location at asecond moment and the first probability is obtained according to thehistorical movement information of the terminal, the second moment islater than the first moment, and a second probability corresponding tothe predicted location is a probability that the terminal is located atthe predicted location at the second moment and the second probabilityis obtained according to the signal strength of the at least onewireless signal.
 7. The terminal according to claim 6, wherein thecomputer-executable codes cause the terminal to: obtain a type of ageographical region in which the first location is located; and obtain,according to the type of the geographical region in which the firstlocation is located, the plurality of predicted locations correspondingto the first location.
 8. The terminal according to claim 7, wherein thegeographical region type comprises at least one of a unidirectionalcorridor, a bidirectional corridor, a unidirectional arc-shapedcorridor, a bidirectional arc-shaped corridor, a plaza, or a connectionregion; wherein: the unidirectional corridor is a rectilinear corridorallowing a pedestrian to walk in one direction; the bidirectionalcorridor is a rectilinear corridor allowing a pedestrian to walk in bothdirections; the unidirectional arc-shaped corridor is an arc-shapedcorridor allowing a pedestrian to walk in one direction; thebidirectional arc-shaped corridor is an arc-shaped corridor allowing apedestrian to walk in both directions; the plaza is a region in which awalking direction of a pedestrian is not restricted; and the connectionregion is a region connecting at least two geographical regions.
 9. Theterminal according to claim 6, wherein the historical movementinformation of the terminal comprises at least one or more of thefollowing: a movement location of the terminal in a preset periodprevious to the first moment, a movement speed of the terminal in thepreset period previous to the first moment, or a movement direction ofthe terminal in the preset period previous to the first moment.
 10. Theterminal according to claim 6, wherein the computer-executable codescause the terminal to: perform weighted summation on the firstprobability and the second probability that are corresponding to thepredicted location, to obtain the third probability corresponding to thepredicted location.
 11. The method according to claim 1, wherein theobtaining, by the terminal, a plurality of predicted locationscorresponding to the first location comprises: obtaining, by theterminal, a type of a geographical region in which the first location islocated and a historical movement speed of the terminal; and obtaining,by the terminal according to the type of the geographical region inwhich the first location is located and the historical movement speed ofthe terminal, the plurality of predicted locations corresponding to thefirst location.
 12. The method according to claim 11, wherein thegeographical region type comprises at least one of a unidirectionalcorridor, a bidirectional corridor, a unidirectional arc-shapedcorridor, a bidirectional arc-shaped corridor, a plaza, or a connectionregion; wherein the unidirectional corridor is a rectilinear corridorallowing a pedestrian to walk in one direction; the bidirectionalcorridor is a rectilinear corridor allowing a pedestrian to walk in bothdirections; the unidirectional arc-shaped corridor is an arc-shapedcorridor allowing a pedestrian to walk in one direction; thebidirectional arc-shaped corridor is an arc-shaped corridor allowing apedestrian to walk in both directions; the plaza is a region in which awalking direction of a pedestrian is not restricted; and the connectionregion is a region connecting at least two geographical regions.
 13. Themethod according to claim 1, wherein the obtaining, by the terminalaccording to the first probability and the second probability that arecorresponding to the predicted location, a third probabilitycorresponding to the predicted location comprises: multiplying, by theterminal, the first probability and the second probability that arecorresponding to the predicted location, to obtain the third probabilitycorresponding to the predicted location.
 14. The terminal according toclaim 6, wherein the computer-executable codes cause the terminal to:obtain a type of a geographical region in which the first location islocated and a historical movement speed of the terminal; and obtain,according to the type of the geographical region in which the firstlocation is located and the historical movement speed of the terminal,the plurality of predicted locations corresponding to the firstlocation.
 15. The terminal according to claim 14, wherein thegeographical region type comprises at least one of a unidirectionalcorridor, a bidirectional corridor, a unidirectional arc-shapedcorridor, a bidirectional arc-shaped corridor, a plaza, or a connectionregion; wherein: the unidirectional corridor is a rectilinear corridorallowing a pedestrian to walk in one direction; the bidirectionalcorridor is a rectilinear corridor allowing a pedestrian to walk in bothdirections; the unidirectional arc-shaped corridor is an arc-shapedcorridor allowing a pedestrian to walk in one direction; thebidirectional arc-shaped corridor is an arc-shaped corridor allowing apedestrian to walk in both directions; the plaza is a region in which awalking direction of a pedestrian is not restricted; and the connectionregion is a region connecting at least two geographical regions.
 16. Theterminal according to claim 6, wherein the computer-executable codescause the terminal to: multiply the first probability and the secondprobability that are corresponding to the predicted location, to obtainthe third probability corresponding to the predicted location.
 17. Anon-transitory computer readable storage medium, including instructionswhich cause a terminal to: obtain a first location of the terminal at afirst moment; obtain a plurality of predicted locations corresponding tothe first location; obtain, according to historical movement informationof the terminal, a first probability corresponding to each predictedlocation; obtain signal strength of at least one wireless signalreceived by the terminal at a second moment; obtain, according to thesignal strength of the at least one wireless signal, a secondprobability corresponding to each predicted location; obtain, accordingto the first probability and the second probability that arecorresponding to each predicted location, a third probabilitycorresponding to each predicted location; and determine a predictedlocation with a highest third probability in the plurality of predictedlocations as a second location of the terminal at the second moment;wherein the first probability corresponding to the predicted location isa probability that the terminal is located at the predicted location ata second moment and the first probability is obtained according to thehistorical movement information of the terminal, the second moment islater than the first moment, and a second probability corresponding tothe predicted location is a probability that the terminal is located atthe predicted location at the second moment and the second probabilityis obtained according to the signal strength of the at least onewireless signal.
 18. The non-transitory computer readable storage mediumaccording to claim 17, wherein the instructions cause the terminal to:obtain a type of a geographical region in which the first location islocated; and obtain, according to the type of the geographical region inwhich the first location is located, the plurality of predictedlocations corresponding to the first location.
 19. The non-transitorycomputer readable storage medium according to claim 17, wherein theinstructions cause the terminal to: obtain a type of a geographicalregion in which the first location is located and a historical movementspeed of the terminal; and obtain, according to the type of thegeographical region in which the first location is located and thehistorical movement speed of the terminal, the plurality of predictedlocations corresponding to the first location.
 20. The non-transitorycomputer readable storage medium according to claim 18, wherein thegeographical region type comprises at least one of a unidirectionalcorridor, a bidirectional corridor, a unidirectional arc-shapedcorridor, a bidirectional arc-shaped corridor, a plaza, or a connectionregion; wherein: the unidirectional corridor is a rectilinear corridorallowing a pedestrian to walk in one direction; the bidirectionalcorridor is a rectilinear corridor allowing a pedestrian to walk in bothdirections; the unidirectional arc-shaped corridor is an arc-shapedcorridor allowing a pedestrian to walk in one direction; thebidirectional arc-shaped corridor is an arc-shaped corridor allowing apedestrian to walk in both directions; the plaza is a region in which awalking direction of a pedestrian is not restricted; and the connectionregion is a region connecting at least two geographical regions.